ActiveReports 9
Modify Data Sources at Run Time
Show AllShow All
Hide AllHide All

In a section report, you can modify your data source at run time. Follow the steps below to connect your report to the NWind.mdb sample database at run time.

To find the database path

Note: These steps assume that the data path is defined in the following registry key.
  1. Right-click the design surface, and select View Code to display the code view for the report.
  2. Add the following code to the report to access the sample database path from the registry.

To write the code in Visual Basic

To write the code in C#

To change the data source at run time

  1. Double-click the gray area outside the design surface to create an event-handling method for the ReportStart event.
  2. Add the following code to the handler to change the data source at run time.

To write the code in Visual Basic.NET

To write the code in C#

To close the data connection

  1. Right-click the gray area outside the design surface and select Properties.
  2. In the Properties Window that appears, click the Events button. A list of report events appear.
  3. Select the ReportEnd event and double click to create an event-handling method.
  4. Add the following code to the handler to close the data connection.

To write the code in Visual Basic

To write the code in C#

See Also

 

 


Copyright © 2014 GrapeCity, inc. All rights reserved

Support Forum